// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010  Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#include "stdpch.h"
#include "places_back_compat.h"

// game_share
#include "game_share/utils.h"
// egs
#include "zone_manager.h"


using namespace NLMISC;
using namespace NLNET;
using namespace std;


namespace BACK_COMPAT
{

// !!! DO NOT EDIT THIS TABLE !!!
/*
static const string OldPlaces[] =
{
	"region_groveofconfusion",
	"region_hiddensource",
	"region_hereticshovel",
	"region_upperbog",
	"region_knollofdissent",
	"region_fleetinggarden",
	"region_majesticgarden",
	"matis_nland",
	"region_groveofumbra",
	"region_citiesofintuition",
	"region_maidengrove",
	"region_thevoid",
	"region_havenofpurity",
	"region_knotofdementia",
	"zorai_nland",
	"region_imperialdunes",
	"region_oflovaksoasis",
	"region_frahartowers",
	"region_sawdustmines",
	"region_dunesofexil",
	"region_thesavagedunes",
	"region_outlawcanyon",
	"region_thescorchedcorridor",
	"fyros_nland",
	"region_lagoonsofloria",
	"region_windsofmuse",
	"region_bountybeaches",
	"region_thefount",
	"region_enchantedisle",
	"region_libertylake",
	"region_dewdrops",
	"region_restingwater",
	"tryker_nland",
	"region_the_land_of_continuty",
	"region_the_sunken_city",
	"region_forbidden_depths",
	"region_the_under_spring",
	"region_the_windy_gate",
	"region_the_elusive_forest",
	"region_gate_of_obscurity",
	"region_the_trench_of_trials",
	"region_nexus",
	"region_the_abyss_of_ichor",
	"place_outpost_matis_24",
	"place_outpost_matis_25",
	"place_outpost_matis_26",
	"place_outpost_matis_27",
	"place_lieudit_groveofconfusion_1",
	"place_lieudit_groveofconfusion_2",
	"place_lieudit_groveofconfusion_3",
	"place_lieudit_groveofconfusion_4",
	"place_outpost_matis_28",
	"place_outpost_matis_29",
	"place_outpost_matis_30",
	"place_outpost_matis_31",
	"place_outpost_matis_32",
	"place_arrival_from_fyros",
	"place_lieudit_hiddensource_1",
	"place_lieudit_hiddensource_2",
	"place_lieudit_hiddensource_3",
	"place_outpost_matis_10",
	"place_outpost_matis_11",
	"place_outpost_matis_12",
	"place_outpost_matis_13",
	"place_outpost_matis_14",
	"place_arrival_from_tryker",
	"place_lieudit_hereticshovel_1",
	"place_lieudit_hereticshovel_2",
	"place_lieudit_hereticshovel_3",
	"place_lieudit_hereticshovel_4",
	"place_outpost_matis_01",
	"place_outpost_matis_02",
	"place_outpost_matis_03",
	"place_outpost_matis_04",
	"place_lieudit_upperbog_1",
	"place_lieudit_upperbog_2",
	"place_lieudit_upperbog_3",
	"place_lieudit_upperbog_4",
	"place_outpost_matis_16",
	"place_outpost_matis_17",
	"place_outpost_matis_18",
	"place_outpost_matis_19",
	"place_outpost_matis_20",
	"place_outpost_matis_21",
	"place_outpost_matis_22",
	"place_outpost_matis_23",
	"place_arrival_from_bagne",
	"place_lieudit_knollofdissent_1",
	"place_lieudit_knollofdissent_2",
	"place_lieudit_knollofdissent_3",
	"place_lieudit_knollofdissent_4",
	"place_lieudit_knollofdissent_5",
	"place_lieudit_knollofdissent_6",
	"place_outpost_matis_05",
	"place_outpost_matis_06",
	"place_outpost_matis_07",
	"place_outpost_matis_08",
	"place_outpost_matis_09",
	"place_lieudit_fleetinggarden_1",
	"place_lieudit_fleetinggarden_2",
	"place_lieudit_fleetinggarden_3",
	"place_lieudit_fleetinggarden_4",
	"place_yrkanis",
	"place_natae",
	"place_davae",
	"place_avalae",
	"place_arena_warning",
	"place_outpost_matis_15",
	"place_lieudit_majesticgarden_1",
	"place_lieudit_majesticgarden_2",
	"place_lieudit_majesticgarden_3",
	"place_yrk_p_1",
	"place_yrk_p_2",
	"place_yrk_p_3",
	"place_yrk_p_4",
	"place_yrk_p_5",
	"place_yrkanis_bar_indoor",
	"place_yrkanis_greenhouse_indoor",
	"place_stalli",
	"place_borea",
	"place_nistia",
	"place_rosilio",
	"place_miani",
	"place_stalli_indoors",
	"place_borea_indoors",
	"place_nistia_indoors",
	"place_rosilio_indoors",
	"place_miani_indoors",
	"place_outpost_zorai_01",
	"place_outpost_zorai_02",
	"place_outpost_zorai_03",
	"place_outpost_zorai_04",
	"place_outpost_zorai_05",
	"place_outpost_zorai_06",
	"place_outpost_zorai_07",
	"place_arrival_from_route_gouffre",
	"place_lieudit_groveofumbra_1",
	"place_lieudit_groveofumbra_2",
	"place_lieudit_groveofumbra_3",
	"place_lieudit_groveofumbra_4",
	"place_zora",
	"place_hoi_cho",
	"place_jen_lai",
	"place_min_cho",
	"place_outpost_zorai_08",
	"place_lieudit_citiesofintuition_1",
	"place_lieudit_citiesofintuition_2",
	"place_lieudit_citiesofintuition_3",
	"place_lieudit_citiesofintuition_4",
	"place_zora_p_cimetiere",
	"place_zora_p_1",
	"place_zora_p_marche_commun",
	"place_zora_p_2",
	"place_zora_p_3",
	"place_zora_p_4",
	"place_zora_p_5",
	"place_outpost_zorai_09",
	"place_outpost_zorai_10",
	"place_outpost_zorai_11",
	"place_outpost_zorai_12",
	"place_outpost_zorai_13",
	"place_outpost_zorai_14",
	"place_lieudit_maidengrove_1",
	"place_lieudit_maidengrove_2",
	"place_lieudit_maidengrove_3",
	"place_lieudit_maidengrove_4",
	"place_lieudit_maidengrove_5",
	"place_outpost_zorai_15",
	"place_outpost_zorai_16",
	"place_outpost_zorai_17",
	"place_outpost_zorai_18",
	"place_outpost_zorai_19",
	"place_arrival_from_terre",
	"place_lieudit_thevoid_1",
	"place_lieudit_thevoid_2",
	"place_lieudit_thevoid_3",
	"place_outpost_zorai_20",
	"place_outpost_zorai_21",
	"place_outpost_zorai_22",
	"place_outpost_zorai_23",
	"place_lieudit_havenofpurity_1",
	"place_lieudit_havenofpurity_2",
	"place_lieudit_havenofpurity_3",
	"place_outpost_zorai_24",
	"place_outpost_zorai_25",
	"place_outpost_zorai_26",
	"place_outpost_zorai_27",
	"place_outpost_zorai_28",
	"place_outpost_zorai_29",
	"place_outpost_zorai_30",
	"place_arrival_from_sources",
	"place_lieudit_knotofdementia_1",
	"place_lieudit_knotofdementia_2",
	"place_lieudit_knotofdementia_3",
	"place_lieudit_knotofdementia_4",
	"place_lieudit_knotofdementia_5",
	"place_lieudit_knotofdementia_6",
	"place_qai_lo",
	"place_sheng_wo",
	"place_men_xing",
	"place_koi_zun",
	"place_yin_piang",
	"place_qai_lo_indoors",
	"place_sheng_wo_indoors",
	"place_men_xing_indoors",
	"place_koi_zun_indoors",
	"place_yin_piang_indoors",
	"place_pyr",
	"place_outpost_fyros_14",
	"place_lieudit_imperialdunes_1",
	"place_lieudit_imperialdunes_2",
	"place_lieudit_imperialdunes_3",
	"place_pyr_p_market_1",
	"place_pyr_p_west_entrance",
	"place_pyr_p_market_2",
	"place_pyr_p_place_warschool",
	"place_pyr_p_fontaine",
	"place_pyr_p_sheriff",
	"place_pyr_p_place_mairie_1",
	"place_pyr_p_place_mairie_2",
	"place_pyr_p_place_agora",
	"place_pyr_p_street_1",
	"place_pyr_p_street_2",
	"place_pyr_p_street_3",
	"place_pyr_p_street_4",
	"place_pyr_p_street_5",
	"place_pyr_p_street_6",
	"place_pyr_p_street_7",
	"place_pyr_p_street_8",
	"place_pyr_p_street_9",
	"place_pyr_p_street_10",
	"place_pyr_p_street_11",
	"place_pyr_p_street_12",
	"place_pyr_p_street_13",
	"place_pyr_p_street_14",
	"place_pyr_p_street_15",
	"place_pyr_p_street_16",
	"place_pyr_p_street_17",
	"place_pyr_p_street_18",
	"place_pyr_p_street_19",
	"place_pyr_p_street_20",
	"place_pyr_p_street_21",
	"place_pyr_p_street_22",
	"place_pyr_p_street_23",
	"place_outpost_fyros_10",
	"place_outpost_fyros_11",
	"place_outpost_fyros_12",
	"place_outpost_fyros_13",
	"place_lieudit_oflovaksoasis_1",
	"place_lieudit_oflovaksoasis_2",
	"place_lieudit_oflovaksoasis_3",
	"place_lieudit_oflovaksoasis_4",
	"place_lieudit_oflovaksoasis_5",
	"place_outpost_fyros_06",
	"place_outpost_fyros_07",
	"place_outpost_fyros_08",
	"place_outpost_fyros_09",
	"place_lieudit_frahartowers_1",
	"place_lieudit_frahartowers_2",
	"place_lieudit_frahartowers_3",
	"place_outpost_fyros_17",
	"place_outpost_fyros_18",
	"place_outpost_fyros_19",
	"place_outpost_fyros_20",
	"place_outpost_fyros_21",
	"place_lieudit_sawdustmines_1",
	"place_lieudit_sawdustmines_2",
	"place_lieudit_sawdustmines_3",
	"place_lieudit_sawdustmines_4",
	"place_lieudit_sawdustmines_5",
	"place_dyron",
	"place_outpost_fyros_01",
	"place_outpost_fyros_02",
	"place_outpost_fyros_03",
	"place_outpost_fyros_04",
	"place_outpost_fyros_05",
	"place_arrival_from_sources",
	"place_lieudit_dunesofexile_1",
	"place_lieudit_dunesofexile_2",
	"place_lieudit_dunesofexile_3",
	"place_lieudit_dunesofexile_4",
	"place_thesos",
	"place_outpost_fyros_22",
	"place_outpost_fyros_23",
	"place_outpost_fyros_24",
	"place_outpost_fyros_25",
	"place_outpost_fyros_26",
	"place_arrival_from_matis",
	"place_lieudit_thesavagedunes_1",
	"place_lieudit_thesavagedunes_2",
	"place_lieudit_thesavagedunes_3",
	"place_lieudit_thesavagedunes_4",
	"place_lieudit_thesavagedunes_5",
	"place_lieudit_thesavagedunes_6",
	"place_outpost_fyros_15",
	"place_outpost_fyros_16",
	"place_lieudit_outlawcanyon_1",
	"place_lieudit_outlawcanyon_2",
	"place_lieudit_outlawcanyon_3",
	"place_outpost_fyros_27",
	"place_outpost_fyros_28",
	"place_arrival_from_route_gouffre",
	"place_lieudit_thescorchedcorridor_1",
	"place_lieudit_thescorchedcorridor_2",
	"place_lieudit_thescorchedcorridor_3",
	"place_aegus",
	"place_kaemon",
	"place_sekovix",
	"place_phyxon",
	"place_galemus",
	"place_aegus_indoors",
	"place_kaemon_indoors",
	"place_sekovix_indoors",
	"place_phyxon_indoors",
	"place_galemus_indoors",
	"place_outpost_tryker_28",
	"place_outpost_tryker_29",
	"place_outpost_tryker_30",
	"place_outpost_tryker_31",
	"place_outpost_tryker_32",
	"place_arrival_from_matis",
	"place_lieudit_lagoonsofloria_1",
	"place_lieudit_lagoonsofloria_2",
	"place_lieudit_lagoonsofloria_3",
	"place_outpost_tryker_23",
	"place_outpost_tryker_24",
	"place_outpost_tryker_25",
	"place_outpost_tryker_26",
	"place_outpost_tryker_27",
	"place_lieudit_windsofmuse_1",
	"place_lieudit_windsofmuse_2",
	"place_lieudit_windsofmuse_3",
	"place_lieudit_windsofmuse_4",
	"place_outpost_tryker_18",
	"place_outpost_tryker_19",
	"place_outpost_tryker_20",
	"place_outpost_tryker_21",
	"place_outpost_tryker_22",
	"place_arrival_from_route_gouffre",
	"place_lieudit_bountybeaches_1",
	"place_lieudit_bountybeaches_2",
	"place_lieudit_bountybeaches_3",
	"place_lieudit_bountybeaches_4",
	"place_lieudit_bountybeaches_5",
	"place_lieudit_bountybeaches_6",
	"place_outpost_tryker_08",
	"place_outpost_tryker_09",
	"place_outpost_tryker_10",
	"place_outpost_tryker_11",
	"place_outpost_tryker_12",
	"place_lieudit_thefount_1",
	"place_lieudit_thefount_2",
	"place_lieudit_thefount_3",
	"place_lieudit_thefount_4",
	"place_lieudit_thefount_5",
	"place_outpost_tryker_13",
	"place_outpost_tryker_14",
	"place_outpost_tryker_15",
	"place_outpost_tryker_16",
	"place_outpost_tryker_17",
	"place_lieudit_enchantedisle_1",
	"place_lieudit_enchantedisle_2",
	"place_lieudit_enchantedisle_3",
	"place_lieudit_enchantedisle_4",
	"place_lieudit_enchantedisle_5",
	"place_outpost_tryker_02",
	"place_outpost_tryker_03",
	"place_outpost_tryker_04",
	"place_outpost_tryker_05",
	"place_outpost_tryker_06",
	"place_outpost_tryker_07",
	"place_avendale",
	"place_crystabell",
	"place_fairhaven",
	"place_windermeer",
	"place_lieudit_libertylake_1",
	"place_lieudit_libertylake_2",
	"place_lieudit_libertylake_3",
	"place_fairhaven_p_1",
	"place_fairhaven_p_2",
	"place_fairhaven_p_3",
	"place_fairhaven_p_4",
	"place_fairhaven_p_5",
	"place_fairhaven_p_6",
	"place_fairhaven_p_7",
	"place_fairhaven_p_8",
	"place_fairhaven_s_1",
	"place_fairhaven_s_2",
	"place_fairhaven_s_3",
	"place_fairhaven_s_4",
	"place_fairhaven_s_5",
	"place_fairhaven_s_6",
	"place_fairhaven_s_7",
	"place_fairhaven_s_8",
	"place_aubermouth",
	"place_barkdell",
	"place_hobwelly",
	"place_waverton",
	"place_dingleton",
	"place_aubermouth_indoors",
	"place_barkdell_indoors",
	"place_hobwelly_indoors",
	"place_waverton_indoors",
	"place_dingleton_indoors",
	"place_outpost_pr_20",
	"place_outpost_pr_21",
	"place_outpost_pr_22",
	"place_outpost_pr_23",
	"place_outpost_pr_24",
	"place_arrival_from_zorai",
	"place_lieudit_the_land_of_continuity_1",
	"place_lieudit_the_land_of_continuity_2",
	"place_lieudit_the_land_of_continuity_3",
	"place_lieudit_the_land_of_continuity_4",
	"place_lieudit_the_land_of_continuity_5",
	"place_outpost_pr_25",
	"place_outpost_pr_26",
	"place_outpost_pr_27",
	"place_arrival_from_nexus",
	"place_lieudit_the_sunken_city_1",
	"place_lieudit_the_sunken_city_2",
	"place_lieudit_the_sunken_city_3",
	"place_outpost_pr_28",
	"place_outpost_pr_29",
	"place_outpost_pr_30",
	"place_lieudit_forbidden_depths_1",
	"place_lieudit_forbidden_depths_2",
	"place_lieudit_forbidden_depths_3",
	"place_outpost_pr_17",
	"place_outpost_pr_18",
	"place_outpost_pr_19",
	"place_arrival_from_fyros",
	"place_arrival_from_zorai",
	"place_lieudit_the_under_spring_1",
	"place_lieudit_the_under_spring_2",
	"place_lieudit_the_under_spring_3",
	"place_lieudit_the_under_spring_4",
	"place_lieudit_the_under_spring_5",
	"place_outpost_pr_04",
	"place_outpost_pr_05",
	"place_outpost_pr_06",
	"place_arrival_from_fyros",
	"place_lieudit_the_windy_gate_1",
	"place_lieudit_the_windy_gate_2",
	"place_lieudit_the_windy_gate_3",
	"place_lieudit_the_windy_gate_4",
	"place_outpost_pr_07",
	"place_outpost_pr_08",
	"place_outpost_pr_09",
	"place_arrival_from_nexus",
	"place_lieudit_the_elusive_forest_1",
	"place_lieudit_the_elusive_forest_2",
	"place_lieudit_the_elusive_forest_3",
	"place_lieudit_the_elusive_forest_4",
	"place_lieudit_the_elusive_forest_5",
	"place_lieudit_the_elusive_forest_6",
	"place_outpost_pr_10",
	"place_outpost_pr_11",
	"place_outpost_pr_12",
	"place_outpost_pr_13",
	"place_lieudit_gateofobscurity_1",
	"place_lieudit_gateofobscurity_2",
	"place_lieudit_gateofobscurity_3",
	"place_lieudit_gateofobscurity_4",
	"place_outpost_pr_14",
	"place_outpost_pr_15",
	"place_outpost_pr_16",
	"place_arrival_from_zorai",
	"place_arrival_from_tryker",
	"place_lieudit_the_trench_of_trials_1",
	"place_lieudit_the_trench_of_trials_2",
	"place_lieudit_the_trench_of_trials_3",
	"place_outpost_nexus_01",
	"place_outpost_nexus_02",
	"place_outpost_nexus_03",
	"place_outpost_nexus_04",
	"place_outpost_nexus_05",
	"place_outpost_nexus_06",
	"place_outpost_nexus_07",
	"place_arrival_from_bagne",
	"place_arrival_from_route_gouffre",
	"place_arrival_from_terre",
	"place_lieudit_nexus_1",
	"place_lieudit_nexus_2",
	"place_lieudit_nexus_3",
	"place_lieudit_nexus_4",
	"place_outpost_pr_01",
	"place_outpost_pr_02",
	"place_outpost_pr_03",
	"place_arrival_from_matis",
	"place_arrival_from_nexus",
	"place_lieudit_the_abyss_of_ichor_1",
	"place_lieudit_the_abyss_of_ichor_2",
	"place_lieudit_the_abyss_of_ichor_3",
	"yrkanis_stable",
	"natae_stable",
	"davae_stable",
	"avalae_stable",
	"zora_stable",
	"hoi_cho_stable",
	"jen_lai_stable",
	"min_cho_stable",
	"pyr_stable1",
	"pyr_stable2",
	"pyr_stable3",
	"dyron_stable",
	"thesos_stable",
	"windermeer_stable",
	"fairhaven_stable",
	"crystabell_stable",
	"avendale_stable",
	"goo_border_20",
	"goo_border_18",
	"goo_border_15",
	"goo_border_24",
	"goo_border_23",
	"goo_border_22"
};

static vector<uint16> OldToNewPlaceId;
*/

void initPlacesCompat()
{
/*	static bool initialized = false;
	if (initialized)
		return;

	const uint nbOldPlaces = sizeof(OldPlaces) / sizeof(OldPlaces[0]);

	OldToNewPlaceId.resize( nbOldPlaces );
	for (uint i = 0; i < nbOldPlaces; i++)
	{
		CPlace * place = CZoneManager::getInstance().getPlaceFromName( OldPlaces[i] );
		uint16 newId = 0xffff;
		if (place)
			newId = place->getId();
		OldToNewPlaceId[i] = newId;

		if (newId == 0xffff)
			nlwarning("<PLACE> old place '%s' has not been found", OldPlaces[i].c_str());
	}

	initialized = true;
*/
}

uint16 oldToNewPlaceId(uint16 oldId)
{
//	BOMB_IF( (oldId >= OldToNewPlaceId.size()), "<oldToNewPlaceId> invalid old place index", return 0xffff );
//	return OldToNewPlaceId[oldId];
	return oldId;
}

} // namespace BACK_COMPAT
